//
// Created by Administrator on 2017/8/4.
//

#include "Template.h"
#include "../image/CodeImage.h"
#include "../image/EditImage.h"

using namespace img;

namespace mahjong {
    ScanPos::ScanPos(short x, short y) :
            mX(x), mY(y), mOffsetX(0), mOffsetY(0) {
    }

    ScanPos::ScanPos(short x, short y, short x1, short y1) :
            mX(x), mY(y), mOffsetX(x1), mOffsetY(y1) {

    }

    short ScanPos::getX() const {
        return mX;
    }

    short ScanPos::getY() const {
        return mY;
    }

    short ScanPos::getOffsetX() const {
        return mOffsetX;
    }

    short ScanPos::getOffsetY() const {
        return mOffsetY;
    }


    ////////////////////////////////////////////////////////////////////////////////////////////
    Item::Item(string path, string maskPath, uint8_t binary, MahjongEnum value,
               ImageChannel channel) {
        mBinary = binary;
        mValue = value;
        mChannel = channel;

        if (0 != path.size()) {
            EditImage edit;
            mTempl = CodeImage::get()->loadImage(path);
            if (CHANNEL_NONE != channel) {
                mTempl = EditImage::get()->channel(mTempl, channel);
            }
            mTempl = EditImage::get()->threshold(mTempl, binary);
            if (0 < maskPath.size())
                mMask = CodeImage::get()->loadImage(maskPath);
        }
    }

    uint8_t Item::getBinary() {
        return mBinary;
    }

    Prt<Image> &Item::getTempl() {
        return mTempl;
    }

    Prt<Image> &Item::getask() {
        return mMask;
    }

    MahjongEnum Item::getValue() {
        return mValue;
    }

    ImageChannel Item::getChannel() {
        return mChannel;
    }

    Item::Item(const Prt<Image> &mTempl, const Prt<Image> &mMask, uint8_t mBinary,
               MahjongEnum mValue, ImageChannel mChannel) :
            mBinary(mBinary),
            mTempl(mTempl),
            mMask(mMask),
            mValue(mValue),
            mChannel(mChannel) {

    }


    ////////////////////////////////////////////////////////////////////////////////////////////////

    Template::Template() {
        mMTong = new Item("template/xm/que_tong.jpg", "", 210, M_Tong, CHANNEL_RED);
        mMTiao = new Item("template/xm/que_tiao.jpg", "", 210, M_Tiao, CHANNEL_RED);
        mMWan = new Item("template/xm/que_wan.jpg", "", 210, M_Wan, CHANNEL_RED);
        mMZhuang = new Item("template/xm/zhuang.jpg", "", 170, M_Zhuang, CHANNEL_NONE);

        mMeBoard.push_back(new Item("template/xm/M_Tong1.jpg", "", 160, M_Tong1, CHANNEL_BLUE));
        mMeBoard.push_back(new Item("template/xm/M_Tong2.jpg", "", 160, M_Tong2, CHANNEL_BLUE));
        mMeBoard.push_back(new Item("template/xm/M_Tong3.jpg", "", 160, M_Tong3, CHANNEL_BLUE));
        mMeBoard.push_back(new Item("template/xm/M_Tong4.jpg", "", 160, M_Tong4, CHANNEL_BLUE));
        mMeBoard.push_back(new Item("template/xm/M_Tong5.jpg", "", 160, M_Tong5, CHANNEL_BLUE));
        mMeBoard.push_back(new Item("template/xm/M_Tong6.jpg", "", 160, M_Tong6, CHANNEL_BLUE));
        mMeBoard.push_back(new Item("template/xm/M_Tong7.jpg", "", 160, M_Tong7, CHANNEL_BLUE));
        mMeBoard.push_back(new Item("template/xm/M_Tong8.jpg", "", 160, M_Tong8, CHANNEL_BLUE));
        mMeBoard.push_back(new Item("template/xm/M_Tong9.jpg", "", 160, M_Tong9, CHANNEL_BLUE));
        mMeBoard.push_back(new Item("template/xm/M_Tiao1.jpg", "", 160, M_Tiao1, CHANNEL_BLUE));
        mMeBoard.push_back(new Item("template/xm/M_Tiao2.jpg", "", 160, M_Tiao2, CHANNEL_BLUE));
        mMeBoard.push_back(new Item("template/xm/M_Tiao3.jpg", "", 160, M_Tiao3, CHANNEL_BLUE));
        mMeBoard.push_back(new Item("template/xm/M_Tiao4.jpg", "", 160, M_Tiao4, CHANNEL_BLUE));
        mMeBoard.push_back(new Item("template/xm/M_Tiao5.jpg", "", 160, M_Tiao5, CHANNEL_BLUE));
        mMeBoard.push_back(new Item("template/xm/M_Tiao6.jpg", "", 160, M_Tiao6, CHANNEL_BLUE));
        mMeBoard.push_back(new Item("template/xm/M_Tiao7.jpg", "", 160, M_Tiao7, CHANNEL_BLUE));
        mMeBoard.push_back(new Item("template/xm/M_Tiao8.jpg", "", 160, M_Tiao8, CHANNEL_BLUE));
        mMeBoard.push_back(new Item("template/xm/M_Tiao9.jpg", "", 160, M_Tiao9, CHANNEL_BLUE));
        mMeBoard.push_back(new Item("template/xm/M_Wan1.jpg", "", 160, M_Wan1, CHANNEL_GREEN));
        mMeBoard.push_back(new Item("template/xm/M_Wan2.jpg", "", 160, M_Wan2, CHANNEL_GREEN));
        mMeBoard.push_back(new Item("template/xm/M_Wan3.jpg", "", 160, M_Wan3, CHANNEL_GREEN));
        mMeBoard.push_back(new Item("template/xm/M_Wan4.jpg", "", 160, M_Wan4, CHANNEL_GREEN));
        mMeBoard.push_back(new Item("template/xm/M_Wan5.jpg", "", 160, M_Wan5, CHANNEL_GREEN));
        mMeBoard.push_back(new Item("template/xm/M_Wan6.jpg", "", 160, M_Wan6, CHANNEL_GREEN));
        mMeBoard.push_back(new Item("template/xm/M_Wan7.jpg", "", 160, M_Wan7, CHANNEL_GREEN));
        mMeBoard.push_back(new Item("template/xm/M_Wan8.jpg", "", 160, M_Wan8, CHANNEL_GREEN));
        mMeBoard.push_back(new Item("template/xm/M_Wan9.jpg", "", 160, M_Wan9, CHANNEL_GREEN));

        mMeOutBoard.push_back(new Item("template/xm/B_Tong1.jpg", "", 160, M_Tong1, CHANNEL_BLUE));
        mMeOutBoard.push_back(new Item("template/xm/B_Tong2.jpg", "", 160, M_Tong2, CHANNEL_BLUE));
        mMeOutBoard.push_back(new Item("template/xm/B_Tong3.jpg", "", 160, M_Tong3, CHANNEL_BLUE));
        mMeOutBoard.push_back(new Item("template/xm/B_Tong4.jpg", "", 160, M_Tong4, CHANNEL_BLUE));
        mMeOutBoard.push_back(new Item("template/xm/B_Tong5.jpg", "", 160, M_Tong5, CHANNEL_BLUE));
        mMeOutBoard.push_back(new Item("template/xm/B_Tong6.jpg", "", 160, M_Tong6, CHANNEL_BLUE));
        mMeOutBoard.push_back(new Item("template/xm/B_Tong7.jpg", "", 160, M_Tong7, CHANNEL_BLUE));
        mMeOutBoard.push_back(new Item("template/xm/B_Tong8.jpg", "", 160, M_Tong8, CHANNEL_BLUE));
        mMeOutBoard.push_back(new Item("template/xm/B_Tong9.jpg", "", 160, M_Tong9, CHANNEL_BLUE));
        mMeOutBoard.push_back(new Item("template/xm/B_Tiao1.jpg", "", 160, M_Tiao1, CHANNEL_BLUE));
        mMeOutBoard.push_back(new Item("template/xm/B_Tiao2.jpg", "", 160, M_Tiao2, CHANNEL_BLUE));
        mMeOutBoard.push_back(new Item("template/xm/B_Tiao3.jpg", "", 160, M_Tiao3, CHANNEL_BLUE));
        mMeOutBoard.push_back(new Item("template/xm/B_Tiao4.jpg", "", 160, M_Tiao4, CHANNEL_BLUE));
        mMeOutBoard.push_back(new Item("template/xm/B_Tiao5.jpg", "", 160, M_Tiao5, CHANNEL_BLUE));
        mMeOutBoard.push_back(new Item("template/xm/B_Tiao6.jpg", "", 160, M_Tiao6, CHANNEL_BLUE));
        mMeOutBoard.push_back(new Item("template/xm/B_Tiao7.jpg", "", 160, M_Tiao7, CHANNEL_BLUE));
        mMeOutBoard.push_back(new Item("template/xm/B_Tiao8.jpg", "", 160, M_Tiao8, CHANNEL_BLUE));
        mMeOutBoard.push_back(new Item("template/xm/B_Tiao9.jpg", "", 160, M_Tiao9, CHANNEL_BLUE));
        mMeOutBoard.push_back(new Item("template/xm/B_Wan1.jpg", "", 160, M_Wan1, CHANNEL_GREEN));
        mMeOutBoard.push_back(new Item("template/xm/B_Wan2.jpg", "", 160, M_Wan2, CHANNEL_GREEN));
        mMeOutBoard.push_back(new Item("template/xm/B_Wan3.jpg", "", 160, M_Wan3, CHANNEL_GREEN));
        mMeOutBoard.push_back(new Item("template/xm/B_Wan4.jpg", "", 160, M_Wan4, CHANNEL_GREEN));
        mMeOutBoard.push_back(new Item("template/xm/B_Wan5.jpg", "", 160, M_Wan5, CHANNEL_GREEN));
        mMeOutBoard.push_back(new Item("template/xm/B_Wan6.jpg", "", 160, M_Wan6, CHANNEL_GREEN));
        mMeOutBoard.push_back(new Item("template/xm/B_Wan7.jpg", "", 160, M_Wan7, CHANNEL_GREEN));
        mMeOutBoard.push_back(new Item("template/xm/B_Wan8.jpg", "", 160, M_Wan8, CHANNEL_GREEN));
        mMeOutBoard.push_back(new Item("template/xm/B_Wan9.jpg", "", 160, M_Wan9, CHANNEL_GREEN));

        mUpBoard.push_back(new Item("template/xm/U_Tong1.jpg", "", 160, M_Tong1, CHANNEL_BLUE));
        mUpBoard.push_back(new Item("template/xm/U_Tong2.jpg", "", 160, M_Tong2, CHANNEL_BLUE));
        mUpBoard.push_back(new Item("template/xm/U_Tong3.jpg", "", 160, M_Tong3, CHANNEL_BLUE));
        mUpBoard.push_back(new Item("template/xm/U_Tong4.jpg", "", 160, M_Tong4, CHANNEL_BLUE));
        mUpBoard.push_back(new Item("template/xm/U_Tong5.jpg", "", 160, M_Tong5, CHANNEL_BLUE));
        mUpBoard.push_back(new Item("template/xm/U_Tong6.jpg", "", 160, M_Tong6, CHANNEL_BLUE));
        mUpBoard.push_back(new Item("template/xm/U_Tong7.jpg", "", 160, M_Tong7, CHANNEL_BLUE));
        mUpBoard.push_back(new Item("template/xm/U_Tong8.jpg", "", 160, M_Tong8, CHANNEL_BLUE));
        mUpBoard.push_back(new Item("template/xm/U_Tong9.jpg", "", 160, M_Tong9, CHANNEL_BLUE));
        mUpBoard.push_back(new Item("template/xm/U_Tiao1.jpg", "", 160, M_Tiao1, CHANNEL_BLUE));
        mUpBoard.push_back(new Item("template/xm/U_Tiao2.jpg", "", 160, M_Tiao2, CHANNEL_BLUE));
        mUpBoard.push_back(new Item("template/xm/U_Tiao3.jpg", "", 160, M_Tiao3, CHANNEL_BLUE));
        mUpBoard.push_back(new Item("template/xm/U_Tiao4.jpg", "", 160, M_Tiao4, CHANNEL_BLUE));
        mUpBoard.push_back(new Item("template/xm/U_Tiao5.jpg", "", 160, M_Tiao5, CHANNEL_BLUE));
        mUpBoard.push_back(new Item("template/xm/U_Tiao6.jpg", "", 160, M_Tiao6, CHANNEL_BLUE));
        mUpBoard.push_back(new Item("template/xm/U_Tiao7.jpg", "", 160, M_Tiao7, CHANNEL_BLUE));
        mUpBoard.push_back(new Item("template/xm/U_Tiao8.jpg", "", 160, M_Tiao8, CHANNEL_BLUE));
        mUpBoard.push_back(new Item("template/xm/U_Tiao9.jpg", "", 160, M_Tiao9, CHANNEL_BLUE));
        mUpBoard.push_back(new Item("template/xm/U_Wan1.jpg", "", 160, M_Wan1, CHANNEL_GREEN));
        mUpBoard.push_back(new Item("template/xm/U_Wan2.jpg", "", 160, M_Wan2, CHANNEL_GREEN));
        mUpBoard.push_back(new Item("template/xm/U_Wan3.jpg", "", 160, M_Wan3, CHANNEL_GREEN));
        mUpBoard.push_back(new Item("template/xm/U_Wan4.jpg", "", 160, M_Wan4, CHANNEL_GREEN));
        mUpBoard.push_back(new Item("template/xm/U_Wan5.jpg", "", 160, M_Wan5, CHANNEL_GREEN));
        mUpBoard.push_back(new Item("template/xm/U_Wan6.jpg", "", 160, M_Wan6, CHANNEL_GREEN));
        mUpBoard.push_back(new Item("template/xm/U_Wan7.jpg", "", 160, M_Wan7, CHANNEL_GREEN));
        mUpBoard.push_back(new Item("template/xm/U_Wan8.jpg", "", 160, M_Wan8, CHANNEL_GREEN));
        mUpBoard.push_back(new Item("template/xm/U_Wan9.jpg", "", 160, M_Wan9, CHANNEL_GREEN));

        mTopBoard.push_back(new Item("template/xm/T_Tong1.jpg", "", 160, M_Tong1, CHANNEL_BLUE));
        mTopBoard.push_back(new Item("template/xm/T_Tong2.jpg", "", 160, M_Tong2, CHANNEL_BLUE));
        mTopBoard.push_back(new Item("template/xm/T_Tong3.jpg", "", 160, M_Tong3, CHANNEL_BLUE));
        mTopBoard.push_back(new Item("template/xm/T_Tong4.jpg", "", 160, M_Tong4, CHANNEL_BLUE));
        mTopBoard.push_back(new Item("template/xm/T_Tong5.jpg", "", 160, M_Tong5, CHANNEL_BLUE));
        mTopBoard.push_back(new Item("template/xm/T_Tong6.jpg", "", 160, M_Tong6, CHANNEL_BLUE));
        mTopBoard.push_back(new Item("template/xm/T_Tong7.jpg", "", 160, M_Tong7, CHANNEL_BLUE));
        mTopBoard.push_back(new Item("template/xm/T_Tong8.jpg", "", 160, M_Tong8, CHANNEL_BLUE));
        mTopBoard.push_back(new Item("template/xm/T_Tong9.jpg", "", 160, M_Tong9, CHANNEL_BLUE));
        mTopBoard.push_back(new Item("template/xm/T_Tiao1.jpg", "", 160, M_Tiao1, CHANNEL_BLUE));
        mTopBoard.push_back(new Item("template/xm/T_Tiao2.jpg", "", 160, M_Tiao2, CHANNEL_BLUE));
        mTopBoard.push_back(new Item("template/xm/T_Tiao3.jpg", "", 160, M_Tiao3, CHANNEL_BLUE));
        mTopBoard.push_back(new Item("template/xm/T_Tiao4.jpg", "", 160, M_Tiao4, CHANNEL_BLUE));
        mTopBoard.push_back(new Item("template/xm/T_Tiao5.jpg", "", 160, M_Tiao5, CHANNEL_BLUE));
        mTopBoard.push_back(new Item("template/xm/T_Tiao6.jpg", "", 160, M_Tiao6, CHANNEL_BLUE));
        mTopBoard.push_back(new Item("template/xm/T_Tiao7.jpg", "", 160, M_Tiao7, CHANNEL_BLUE));
        mTopBoard.push_back(new Item("template/xm/T_Tiao8.jpg", "", 160, M_Tiao8, CHANNEL_BLUE));
        mTopBoard.push_back(new Item("template/xm/T_Tiao9.jpg", "", 160, M_Tiao9, CHANNEL_BLUE));
        mTopBoard.push_back(new Item("template/xm/T_Wan1.jpg", "", 160, M_Wan1, CHANNEL_GREEN));
        mTopBoard.push_back(new Item("template/xm/T_Wan2.jpg", "", 160, M_Wan2, CHANNEL_GREEN));
        mTopBoard.push_back(new Item("template/xm/T_Wan3.jpg", "", 160, M_Wan3, CHANNEL_GREEN));
        mTopBoard.push_back(new Item("template/xm/T_Wan4.jpg", "", 160, M_Wan4, CHANNEL_GREEN));
        mTopBoard.push_back(new Item("template/xm/T_Wan5.jpg", "", 160, M_Wan5, CHANNEL_GREEN));
        mTopBoard.push_back(new Item("template/xm/T_Wan6.jpg", "", 160, M_Wan6, CHANNEL_GREEN));
        mTopBoard.push_back(new Item("template/xm/T_Wan7.jpg", "", 160, M_Wan7, CHANNEL_GREEN));
        mTopBoard.push_back(new Item("template/xm/T_Wan8.jpg", "", 160, M_Wan8, CHANNEL_GREEN));
        mTopBoard.push_back(new Item("template/xm/T_Wan9.jpg", "", 160, M_Wan9, CHANNEL_GREEN));

        mDownBoard.push_back(new Item("template/xm/D_Tong1.jpg", "", 160, M_Tong1, CHANNEL_BLUE));
        mDownBoard.push_back(new Item("template/xm/D_Tong2.jpg", "", 160, M_Tong2, CHANNEL_BLUE));
        mDownBoard.push_back(new Item("template/xm/D_Tong3.jpg", "", 160, M_Tong3, CHANNEL_BLUE));
        mDownBoard.push_back(new Item("template/xm/D_Tong4.jpg", "", 160, M_Tong4, CHANNEL_BLUE));
        mDownBoard.push_back(new Item("template/xm/D_Tong5.jpg", "", 160, M_Tong5, CHANNEL_BLUE));
        mDownBoard.push_back(new Item("template/xm/D_Tong6.jpg", "", 160, M_Tong6, CHANNEL_BLUE));
        mDownBoard.push_back(new Item("template/xm/D_Tong7.jpg", "", 160, M_Tong7, CHANNEL_BLUE));
        mDownBoard.push_back(new Item("template/xm/D_Tong8.jpg", "", 160, M_Tong8, CHANNEL_BLUE));
        mDownBoard.push_back(new Item("template/xm/D_Tong9.jpg", "", 160, M_Tong9, CHANNEL_BLUE));
        mDownBoard.push_back(new Item("template/xm/D_Tiao1.jpg", "", 160, M_Tiao1, CHANNEL_BLUE));
        mDownBoard.push_back(new Item("template/xm/D_Tiao2.jpg", "", 160, M_Tiao2, CHANNEL_BLUE));
        mDownBoard.push_back(new Item("template/xm/D_Tiao3.jpg", "", 160, M_Tiao3, CHANNEL_BLUE));
        mDownBoard.push_back(new Item("template/xm/D_Tiao4.jpg", "", 160, M_Tiao4, CHANNEL_BLUE));
        mDownBoard.push_back(new Item("template/xm/D_Tiao5.jpg", "", 160, M_Tiao5, CHANNEL_BLUE));
        mDownBoard.push_back(new Item("template/xm/D_Tiao6.jpg", "", 160, M_Tiao6, CHANNEL_BLUE));
        mDownBoard.push_back(new Item("template/xm/D_Tiao7.jpg", "", 160, M_Tiao7, CHANNEL_BLUE));
        mDownBoard.push_back(new Item("template/xm/D_Tiao8.jpg", "", 160, M_Tiao8, CHANNEL_BLUE));
        mDownBoard.push_back(new Item("template/xm/D_Tiao9.jpg", "", 160, M_Tiao9, CHANNEL_BLUE));
        mDownBoard.push_back(new Item("template/xm/D_Wan1.jpg", "", 160, M_Wan1, CHANNEL_GREEN));
        mDownBoard.push_back(new Item("template/xm/D_Wan2.jpg", "", 160, M_Wan2, CHANNEL_GREEN));
        mDownBoard.push_back(new Item("template/xm/D_Wan3.jpg", "", 160, M_Wan3, CHANNEL_GREEN));
        mDownBoard.push_back(new Item("template/xm/D_Wan4.jpg", "", 160, M_Wan4, CHANNEL_GREEN));
        mDownBoard.push_back(new Item("template/xm/D_Wan5.jpg", "", 160, M_Wan5, CHANNEL_GREEN));
        mDownBoard.push_back(new Item("template/xm/D_Wan6.jpg", "", 160, M_Wan6, CHANNEL_GREEN));
        mDownBoard.push_back(new Item("template/xm/D_Wan7.jpg", "", 160, M_Wan7, CHANNEL_GREEN));
        mDownBoard.push_back(new Item("template/xm/D_Wan8.jpg", "", 160, M_Wan8, CHANNEL_GREEN));
        mDownBoard.push_back(new Item("template/xm/D_Wan9.jpg", "", 160, M_Wan9, CHANNEL_GREEN));

        mMeOpenBoard.push_back(new Item("template/xm/O_Tong1.jpg", "", 160, M_Tong1, CHANNEL_BLUE));
        mMeOpenBoard.push_back(new Item("template/xm/O_Tong2.jpg", "", 160, M_Tong2, CHANNEL_BLUE));
        mMeOpenBoard.push_back(new Item("template/xm/O_Tong3.jpg", "", 160, M_Tong3, CHANNEL_BLUE));
        mMeOpenBoard.push_back(new Item("template/xm/O_Tong4.jpg", "", 160, M_Tong4, CHANNEL_BLUE));
        mMeOpenBoard.push_back(new Item("template/xm/O_Tong5.jpg", "", 160, M_Tong5, CHANNEL_BLUE));
        mMeOpenBoard.push_back(new Item("template/xm/O_Tong6.jpg", "", 160, M_Tong6, CHANNEL_BLUE));
        mMeOpenBoard.push_back(new Item("template/xm/O_Tong7.jpg", "", 160, M_Tong7, CHANNEL_BLUE));
        mMeOpenBoard.push_back(new Item("template/xm/O_Tong8.jpg", "", 160, M_Tong8, CHANNEL_BLUE));
        mMeOpenBoard.push_back(new Item("template/xm/O_Tong9.jpg", "", 160, M_Tong9, CHANNEL_BLUE));
        mMeOpenBoard.push_back(new Item("template/xm/O_Tiao1.jpg", "", 160, M_Tiao1, CHANNEL_BLUE));
        mMeOpenBoard.push_back(new Item("template/xm/O_Tiao2.jpg", "", 160, M_Tiao2, CHANNEL_BLUE));
        mMeOpenBoard.push_back(new Item("template/xm/O_Tiao3.jpg", "", 160, M_Tiao3, CHANNEL_BLUE));
        mMeOpenBoard.push_back(new Item("template/xm/O_Tiao4.jpg", "", 160, M_Tiao4, CHANNEL_BLUE));
        mMeOpenBoard.push_back(new Item("template/xm/O_Tiao5.jpg", "", 160, M_Tiao5, CHANNEL_BLUE));
        mMeOpenBoard.push_back(new Item("template/xm/O_Tiao6.jpg", "", 160, M_Tiao6, CHANNEL_BLUE));
        mMeOpenBoard.push_back(new Item("template/xm/O_Tiao7.jpg", "", 160, M_Tiao7, CHANNEL_BLUE));
        mMeOpenBoard.push_back(new Item("template/xm/O_Tiao8.jpg", "", 160, M_Tiao8, CHANNEL_BLUE));
        mMeOpenBoard.push_back(new Item("template/xm/O_Tiao9.jpg", "", 160, M_Tiao9, CHANNEL_BLUE));
        mMeOpenBoard.push_back(new Item("template/xm/O_Wan1.jpg", "", 160, M_Wan1, CHANNEL_GREEN));
        mMeOpenBoard.push_back(new Item("template/xm/O_Wan2.jpg", "", 160, M_Wan2, CHANNEL_GREEN));
        mMeOpenBoard.push_back(new Item("template/xm/O_Wan3.jpg", "", 160, M_Wan3, CHANNEL_GREEN));
        mMeOpenBoard.push_back(new Item("template/xm/O_Wan4.jpg", "", 160, M_Wan4, CHANNEL_GREEN));
        mMeOpenBoard.push_back(new Item("template/xm/O_Wan5.jpg", "", 160, M_Wan5, CHANNEL_GREEN));
        mMeOpenBoard.push_back(new Item("template/xm/O_Wan6.jpg", "", 160, M_Wan6, CHANNEL_GREEN));
        mMeOpenBoard.push_back(new Item("template/xm/O_Wan7.jpg", "", 160, M_Wan7, CHANNEL_GREEN));
        mMeOpenBoard.push_back(new Item("template/xm/O_Wan8.jpg", "", 160, M_Wan8, CHANNEL_GREEN));
        mMeOpenBoard.push_back(new Item("template/xm/O_Wan9.jpg", "", 160, M_Wan9, CHANNEL_GREEN));

        mScanMeOut.push_back(ScanPos(464, 516));
        mScanMeOut.push_back(ScanPos(499, 516));
        mScanMeOut.push_back(ScanPos(534, 516));
        mScanMeOut.push_back(ScanPos(569, 516));
        mScanMeOut.push_back(ScanPos(604, 516));
        mScanMeOut.push_back(ScanPos(639, 516));
        mScanMeOut.push_back(ScanPos(674, 516));
        mScanMeOut.push_back(ScanPos(709, 516));
        mScanMeOut.push_back(ScanPos(744, 516));
        mScanMeOut.push_back(ScanPos(779, 516));

        mScanMeOut.push_back(ScanPos(464, 475));
        mScanMeOut.push_back(ScanPos(499, 475));
        mScanMeOut.push_back(ScanPos(534, 475));
        mScanMeOut.push_back(ScanPos(569, 475));
        mScanMeOut.push_back(ScanPos(604, 475));
        mScanMeOut.push_back(ScanPos(639, 475));
        mScanMeOut.push_back(ScanPos(674, 475));
        mScanMeOut.push_back(ScanPos(709, 475));
        mScanMeOut.push_back(ScanPos(744, 475));
        mScanMeOut.push_back(ScanPos(779, 475));

        mScanTopOut.push_back(ScanPos(823, 136));
        mScanTopOut.push_back(ScanPos(788, 136));
        mScanTopOut.push_back(ScanPos(753, 136));
        mScanTopOut.push_back(ScanPos(718, 136));
        mScanTopOut.push_back(ScanPos(683, 136));
        mScanTopOut.push_back(ScanPos(648, 136));
        mScanTopOut.push_back(ScanPos(613, 136));
        mScanTopOut.push_back(ScanPos(578, 136));
        mScanTopOut.push_back(ScanPos(543, 136));
        mScanTopOut.push_back(ScanPos(508, 136));
        mScanTopOut.push_back(ScanPos(823, 177));
        mScanTopOut.push_back(ScanPos(788, 177));
        mScanTopOut.push_back(ScanPos(753, 177));
        mScanTopOut.push_back(ScanPos(718, 177));
        mScanTopOut.push_back(ScanPos(683, 177));
        mScanTopOut.push_back(ScanPos(648, 177));
        mScanTopOut.push_back(ScanPos(613, 177));
        mScanTopOut.push_back(ScanPos(578, 177));
        mScanTopOut.push_back(ScanPos(543, 177));
        mScanTopOut.push_back(ScanPos(508, 177));

        mScanDownOut.push_back(ScanPos(1022, 485));
        mScanDownOut.push_back(ScanPos(1022, 458));
        mScanDownOut.push_back(ScanPos(1022, 431));
        mScanDownOut.push_back(ScanPos(1022, 404));
        mScanDownOut.push_back(ScanPos(1022, 377));
        mScanDownOut.push_back(ScanPos(1022, 350));
        mScanDownOut.push_back(ScanPos(1022, 323));
        mScanDownOut.push_back(ScanPos(1022, 296));
        mScanDownOut.push_back(ScanPos(1022, 269));
        mScanDownOut.push_back(ScanPos(1022, 242));
        mScanDownOut.push_back(ScanPos(975, 485));
        mScanDownOut.push_back(ScanPos(975, 458));
        mScanDownOut.push_back(ScanPos(975, 431));
        mScanDownOut.push_back(ScanPos(975, 404));
        mScanDownOut.push_back(ScanPos(975, 377));
        mScanDownOut.push_back(ScanPos(975, 350));
        mScanDownOut.push_back(ScanPos(975, 323));
        mScanDownOut.push_back(ScanPos(975, 296));
        mScanDownOut.push_back(ScanPos(975, 269));
        mScanDownOut.push_back(ScanPos(975, 242));

        mScanUpOut.push_back(ScanPos(312, 119));
        mScanUpOut.push_back(ScanPos(312, 146));
        mScanUpOut.push_back(ScanPos(312, 173));
        mScanUpOut.push_back(ScanPos(312, 200));
        mScanUpOut.push_back(ScanPos(312, 227));
        mScanUpOut.push_back(ScanPos(312, 254));
        mScanUpOut.push_back(ScanPos(312, 281));
        mScanUpOut.push_back(ScanPos(312, 308));
        mScanUpOut.push_back(ScanPos(312, 335));
        mScanUpOut.push_back(ScanPos(312, 362));
        mScanUpOut.push_back(ScanPos(359, 119));
        mScanUpOut.push_back(ScanPos(359, 146));
        mScanUpOut.push_back(ScanPos(359, 173));
        mScanUpOut.push_back(ScanPos(359, 200));
        mScanUpOut.push_back(ScanPos(359, 227));
        mScanUpOut.push_back(ScanPos(359, 254));
        mScanUpOut.push_back(ScanPos(359, 281));
        mScanUpOut.push_back(ScanPos(359, 308));
        mScanUpOut.push_back(ScanPos(359, 335));
        mScanUpOut.push_back(ScanPos(359, 362));

        mScanUp.push_back(ScanPos(247, 126, 0, -12));
        mScanUp.push_back(ScanPos(247, 221, 0, -12));
        mScanUp.push_back(ScanPos(247, 316, 0, -12));
        mScanUp.push_back(ScanPos(247, 412, 0, -12));

        mScanDown.push_back(ScanPos(1089, 468, 0, -12));
        mScanDown.push_back(ScanPos(1089, 374, 0, -12));
        mScanDown.push_back(ScanPos(1089, 280, 0, -12));
        mScanDown.push_back(ScanPos(1089, 186, 0, -12));

        mScanMeOpen.push_back(ScanPos(115, 617, 24, 0));
        mScanMeOpen.push_back(ScanPos(285, 617, 24, 0));
        mScanMeOpen.push_back(ScanPos(455, 617, 24, 0));
        mScanMeOpen.push_back(ScanPos(625, 617, 24, 0));

        mScanTop.push_back(ScanPos(837, 65, 0, -15));
        mScanTop.push_back(ScanPos(725, 65, 0, -15));
        mScanTop.push_back(ScanPos(613, 65, 0, -15));
        mScanTop.push_back(ScanPos(501, 65, 0, -15));

        mTopLack = Rect(1005, 140, 30, 30);
        mUpLack = Rect(112, 255, 30, 30);
        mMeLack = Rect(162, 439, 30, 30);
        mDownLack = Rect(1229, 306, 30, 30);

        mTopDealer = Rect(911, 75, 30, 30);
        mUpDealer = Rect(24, 195, 30, 30);
        mMeDealer = Rect(64, 376, 30, 30);
        mDownDealer = Rect(1133, 238, 30, 30);
    }

    Prt<Item> &Template::getMTong() {
        return mMTong;
    }

    Prt<Item> &Template::getMTiao() {
        return mMTiao;
    }

    Prt<Item> &Template::getMWan() {
        return mMWan;
    }

    Prt<Item> &Template::getMZhuang() {
        return mMZhuang;
    }

    vector<Prt<Item>> &Template::getMeBoard() {
        return mMeBoard;
    }

    vector<Prt<Item>> &Template::getMeOutBoard() {
        return mMeOutBoard;
    }

    vector<Prt<Item>> &Template::getTopBoard() {
        return mTopBoard;
    }

    vector<Prt<Item>> &Template::getUpBoard() {
        return mUpBoard;
    }

    vector<Prt<Item>> &Template::getDownBoard() {
        return mDownBoard;
    }

    vector<ScanPos> &Template::getScanUpOut() {
        return mScanUpOut;
    }

    vector<ScanPos> &Template::getScanDownOut() {
        return mScanDownOut;
    }

    vector<ScanPos> &Template::getScanMeOut() {
        return mScanMeOut;
    }

    vector<ScanPos> &Template::getScanTopOut() {
        return mScanTopOut;
    }

    vector<ScanPos> &Template::getScanUp() {
        return mScanUp;
    }

    vector<ScanPos> &Template::getScanDown() {
        return mScanDown;
    }

    vector<ScanPos> &Template::getScanTop() {
        return mScanTop;
    }

    vector<Prt<Item>> &Template::getMeOpenBoard() {
        return mMeOpenBoard;
    }

    Rect &Template::getTopLack() {
        return mTopLack;
    }

    Rect &Template::getUpLack() {
        return mUpLack;
    }

    Rect &Template::getDownLack() {
        return mDownLack;
    }

    Rect &Template::getMeLack() {
        return mMeLack;
    }

    Rect &Template::getDownDealer() {
        return mDownDealer;
    }

    Rect &Template::getMeDealer() {
        return mMeDealer;
    }

    Rect &Template::getUpDealer() {
        return mUpDealer;
    }

    Rect &Template::getTopDealer() {
        return mTopDealer;
    }

    vector<ScanPos> &Template::getMScanMeOpen() {
        return mScanMeOpen;
    }


}

